package conservare.util;

public class StringUtil {
	
	
	public static synchronized String trimLeadingZeros(String str){
		
	    if (str == null) {
	        return null; //if null return null
	    }
	    
	    char[] c = str.toCharArray();
	    int i = 0;
	
	    for(; i<c.length; i++){
	    	
	        if(c[i]=='0'){
	           continue; 
	        }
	        else if(c[i]>='1' && c[i]<='9')
	        {
	            break;
	        }else {
	            return str;
	        }
	    }
	    
	    if(i==0 || i==c.length){
	        return str;
	    }else{
	    	
	        char[] temp = new char[c.length-i];
	        int index = 0;
	        for(int j=i; j<c.length; j++){
	            temp[index++] = c[j];
	        }
	        return new String(temp);
	    }
    }
}
